package 力扣题库;

public class p1662检查两个字符串数组是否相等 {
    public boolean arrayStringsAreEqual1(String[] word1, String[] word2) {
        StringBuilder str1=new StringBuilder();
        StringBuilder str2=new StringBuilder();

        for (int i = 0; i <word1.length; i++) {
            str1.append(word1[i]);
        }

        for (int i = 0; i <word2.length; i++) {
            str2.append(word2[i]);
        }

        String s1 = str1.toString();
        String s2 = str2.toString();
        return s1.equals(s2);
    }

    public boolean arrayStringsAreEqual(String[] word1, String[] word2) {
        String str1="";
        String str2="";
        for (int i = 0; i <word1.length; i++) {
            str1 = str1+word1[i];
        }

        for (int i = 0; i <word2.length; i++) {
            str2 = str2+word2[i];
        }

        return str1.equals(str2);
    }
}
